<!-- Modal -->
<div class="modal fade " id="addValueQuotaValueModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">添加指标值</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal">
                <div class="box-body">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">具体指标</label>
                        <div class="col-sm-7">
                            <input id="valueQuotaTypeName" type="text" class="form-control" readonly>
                            <input id="valueQuotaTypeId" type="hidden" class="form-control">
                            <input id="valueId" type="hidden" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">指标值名称</label>
                        <div class="col-sm-7">
                            <input id="valueQuotaValueName" type="text" class="form-control">
                        </div>
                        <div id="shuruDiv" class="col-sm-3" style="color: red;">
                            指标值只能包含数字和“(,[,],),>,<,≤,≥”
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">分数</label>
                        <div id="statusDiv" class="radio col-sm-7">
                            <input id="valueScore" type="text" class="form-control" style="width:100%;">
                        </div>
                    </div>                  
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary pull-right" onclick="saveValueQuotaValue()">添加</button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>
<script>
    function quotaValueInit() {
        $("#valueId").val("");
        $("#valueQuotaTypeName").val("");
        $("#valueQuotaTypeId").val("");
        $("#valueQuotaValueName").val("");
        $("#valueScore").val("");
        $("input[name='valueIsVeto'][value='0']").attr("checked",'true');
        $("#shuruDiv").css("display","none");
    }

    function quotaValueSetValue(data){
        $("#valueId").val(data.id);
        $("#valueQuotaValueName").val(data.quotaValueName);
        $("#valueScore").val(data.score);
        $("input[name='valueIsVeto'][value='"+data.isVeto+"']").attr("checked",'true');
    }

    function saveValueQuotaValue() {
        var data = {
            id: $("#valueId").val(),
            quotaTypeId: $("#valueQuotaTypeId").val(),
            quotaValueName: $("#valueQuotaValueName").val(),
            score: $("#valueScore").val(),
            isVeto: $("input[name='valueIsVeto']:checked").val()
        };
        var url = "/evaluationquota/value/add";
        if(data.id != "" && data.id != undefined) {
            url = "/evaluationquota/value/modify" ;
        }
        postReq(url, data, function (result) {
            if (result.success) {
                toastr['success']('操作成功', '提示');
                refreshTable('table3');
                $("#addValueQuotaValueModal").modal("hide");
            } else {
                toastr['error'](result.msg, '提示');
            }
        });
    }

</script>
